package com.test.burnincash.activity_fragment_burnin.base_burnin;

import android.text.TextUtils;

import androidx.fragment.app.Fragment;

import com.test.burnincash.util_burnin.http_burnin.HttpManager_burnin;

public class BaseFragment_burnin extends Fragment {

    protected String pageTag_burnin;

    @Override
    public void onResume() {
        super.onResume();
        recordPageResumeEvent_burnin();
    }

    @Override
    public void onPause() {
        super.onPause();
        recordPagePauseEvent_burnin();
    }


    //页面埋点
    private void recordPagePauseEvent_burnin() {
        //保存埋点
        String fragmentName = getClass().getSimpleName();
        if (!TextUtils.isEmpty(pageTag_burnin)) fragmentName = pageTag_burnin;
        if (!TextUtils.isEmpty(fragmentName)) {
            HttpManager_burnin.getInstance().saveUserBuriedPoint((fragmentName + "_END").toUpperCase());
        }
    }

    //页面埋点
    private void recordPageResumeEvent_burnin() {
        //保存埋点
        String fragmentName = getClass().getSimpleName();
        if (!TextUtils.isEmpty(pageTag_burnin)) fragmentName = pageTag_burnin;
        if (!TextUtils.isEmpty(fragmentName)) {
            HttpManager_burnin.getInstance().saveUserBuriedPoint((fragmentName + "_START").toUpperCase());
        }
    }

}
